import request from '@/utils/request'
/**
 * 查询字典项
 */
export function getDictByCode(dictCode) {
  return request({
    baseURL: '/API-ENTERPRISE-BACKEND/',
    url: '/backend/sysDictionary/getDictByCode',
    method: 'get',
    params: { dictCode }
  })
}

/**
 * 获取字典
 */
export function getDictTree() {
  return request({
    baseURL: '/API-ENTERPRISE-BACKEND/',
    url: '/backend/sysDictionary/query',
    method: 'post'
  })
}

/**
 * 根据code查询字典项
 */
export function getDictEntryByCode(data) {
  return request({
    baseURL: '/API-ENTERPRISE-BACKEND/',
    url: '/backend/sysDictionary/queryDetails',
    method: 'post',
    data
  })
}

/**
 * 查询字典详情
 */
export function getDictEntry(data) {
  return request({
    baseURL: '/API-ENTERPRISE-BACKEND/',
    url: '/backend/sysDictionary/get',
    method: 'post',
    data
  })
}

/**
 * 编辑字典项
 */
export function updateDictEntry(data) {
  return request({
    baseURL: '/API-ENTERPRISE-BACKEND/',
    url: '/backend/sysDictionary/update',
    method: 'post',
    data
  })
}

/**
 * 删除字典项
 */
export function deleteDictEntry(id) {
  return request({
    baseURL: '/API-ENTERPRISE-BACKEND/',
    url: '/backend/sysDictionary/delete',
    method: 'get',
    params: { id }
  })
}
